<template>
  <view class="hpu_item_block">
    <view class="network">
      <view class="left">
        <image src="../../assets/images/codeList/network_house.png"></image>
        <text>{{ props.item.companyName }}网点</text>
      </view>
    </view>
    <view class="codes" v-for="(item,index) in props.item.orderList">
      <view class="order">
        <view class="order_text">
          <text>承运单号：{{ item.billNo }}</text>
        </view>
        <view class="order_status" v-if="item.allPaid">已结清</view>
        <view class="order_status" v-else style="color:#ff8f1f">¥{{parseFloat(getLeftPrice(item)).toFixed(2)}}</view>
      </view>
      <view class="addr">
        <view class="title_1">发</view>
        <view class="name">{{ item.shipper }}</view>
        <view class="pos">{{ item.toProvince }}&nbsp;{{ item.toFromCity }}</view>
      </view>
      <view class="addr">
        <view class="title_2">收</view>
        <view class="name">{{ item.receiver }}</view>
        <view class="pos">{{ item.fromProvince }}&nbsp;{{ item.fromCity }}</view>
      </view>
      <view class="goods">
        <view class="goods_pickup_d" v-for="(gInfo,index) in item.goodsInfo">
          <view class="goods_number_text">
            <text>{{gInfo.goodsName}}</text>
            <text class="subs">（已取{{gInfo.upNumber}}/共{{gInfo.goodsNumber}}件）</text>
          </view>
          <nut-input-number min="0" :max="gInfo.goodsNumber-gInfo.upNumber" v-model="gInfo.number" />
        </view>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import Taro from "@tarojs/taro"
import { ref, defineProps, defineEmits } from 'vue'
import {Del, Edit} from "@nutui/icons-vue-taro";
import {$get,$post} from "@/@api";
import useMyOrderStore from "@/store/myOrder";
import useUserInfoStore from "@/store/user";
import useTransactionStore,{ transaction } from "@/store/pickUp";
import dialBranch from "@/components/dialBranch/index"
const props = defineProps<{
  item: any
  index: number,
}>()
const emit = defineEmits(['gotoForwarding','chooseAll'])

const orderStore = useMyOrderStore()
const userStore = useUserInfoStore()
const transactionStore = useTransactionStore()

console.log(props.item,35768)

//计算代付款金额
const getLeftPrice = (row)=>{
  return row.costList.reduce((sum,item)=>{
    return sum + (parseFloat(item.actualMoney) - parseFloat(item.paidMoney))
  },0)
}


</script>

<style lang="scss">
.hpu_item_block {
  width: 100%;
  background-color: #fff;
  border-radius: 16rpx;
  margin-top: 16rpx;
  overflow: scroll;
  padding: 0 24rpx;
  box-sizing: border-box;
  height: 87vh;
  .network {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 104rpx;
    border-bottom: 1px solid #f5f5f5;
    .left {
      display: flex;
      align-items: center;
      image {
        width: 36rpx;
        height: 36rpx;
      }
      text {
        margin-left: 8rpx;
        font-size: 28rpx;
        color: #252525;
        font-weight: 500;
      }
    }
  }
  .codes {
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 24rpx;
    border-bottom: 1px solid #f5f5f5;
    .order {
      width: 100%;
      height: 28rpx;
      margin-top: 24rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 22rpx;
      color: #252525;
      .order_text {
        display: flex;
        align-items: center;
      }
      .order_status {
        color: #999;
        font-size: 28rpx;
      }
    }
  }
  .addr {
    width: 100%;
    margin-top: 24rpx;
    display: flex;
    align-items: center;
    font-weight: 500;
    .title_1 {
      width: 40rpx;
      height: 40rpx;
      line-height: 40rpx;
      text-align: center;
      background: linear-gradient(150deg, #3783FF 14%, #125AD2 93%);
      color: #fff;
      font-size: 20rpx;
      border-radius: 8rpx;
    }
    .title_2 {
      width: 40rpx;
      height: 40rpx;
      line-height: 40rpx;
      text-align: center;
      background: linear-gradient(137deg, #13E879 14%, #0EC365 89%);
      color: #fff;
      font-size: 20rpx;
      border-radius: 8rpx;
    }
    .name {
      margin-left: 16rpx;
      font-size: 28rpx;
      color: #252525;
      width: 120rpx;
    }
    .pos {
      margin-left: 24rpx;
      width: calc(100% - 200rpx);
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      color: #252525;
      font-weight: bold;
      font-size: 28px;
    }
  }
  .goods {
    width: 100%;
    border-radius: 8rpx;
    background-color: #f5f5f5;
    margin-top: 24rpx;
    font-size: 24rpx;
    line-height: 32rpx;
    color: #666;
    box-sizing: border-box;
    padding: 0 24rpx;
    .goods_pickup_d {
      border-top: 1rpx solid #f5f5f5;
      width: 100%;
      height: 88rpx;
      line-height: 88rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .goods_number_text {
        color: #252525;
        font-size: 26rpx;
        .subs {
          color: #0966ff;
        }
      }
      &:first-child {
        border: none;
      }
    }
  }
}
.nut-checkbox__label {
  margin-left: 0;
}
</style>
